$(function()
	{
		// 1 - Setup Up-to-top button
		  $('#btn-up').click(function() {
			$('html,body').animate({scrollTop: 0}, 'slow');
		  });

		  $(window).scroll(function(){
			 if($(window).scrollTop()<400){
				$('#btn-up').fadeOut();
			 }else{
				$('#btn-up').fadeIn();
			 }
		  });
	  
		// 2 - Enable skills tabs
		$('#skillsTab a').click(function (e) {
		  e.preventDefault();
		  $(this).tab('show');
		});
		
		// 3 - Animation of the header picture
		$('section#header div#header-picture button').hover(
		  function() {
			$("section#header div#header-picture").stop().animate({
			  backgroundPositionX: '100%',
			  backgroundPositionY: '100%'
			});
		  },
		  function () {
			$("section#header div#header-picture").stop().animate({
			  backgroundPositionX: '0%',
			  backgroundPositionY: '0%'
			});
		  }
		);
		
		//4 - Citation height
		$(window).resize(function() 
		{
			var w = -$("section#header div#header-citation").height();
			$("section#header div#header-citation").css('top', w + "px");
			$("section#header div#header-citation").css('margin-bottom', w + "px");
		});
		
		$(window).resize();
		
		//5 - Windows phone 8 fix
		if (navigator.userAgent.match(/IEMobile\/10\.0/)) {
		  var msViewportStyle = document.createElement("style")
		  msViewportStyle.appendChild(
			document.createTextNode(
			  "@-ms-viewport{width:auto!important}"
			)
		  )
		  document.getElementsByTagName("head")[0].appendChild(msViewportStyle)
		}
		
		//6 - Tooltip activation
		$('[data-toggle="tooltip"]').tooltip();
		
		//7 - Labo article enabled
		$('div.article-hidden').click(
			function()
			{
				$(this).toggleClass('article-hidden', false);
				$(this).toggleClass('article-active', true);
			}
		);
                    
                     
                //8- Activation de la lightbox
                $('a.lightbox_elem').fancybox({
                        beforeLoad: function() {
                            this.title = $(this.element).children().attr('title');
                        }
                    });
               
               //9- Activation du slider
                $('.carousel').carousel({
                    interval: 2000
                  });
                  
                  
                //10- Activation de la coloration syntaxique
                SyntaxHighlighter.all();
                
                
	}
);